<layout name='Layout/layout_main' />
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.js"></script>
<script type="text/javascript" src="__PUBLIC__/editor/kindeditor.setting.js"></script>
<script type="text/javascript">	
	function save(){
		$("#tag").val("");
		$("#tag_wrap  span").each(function() {
			$("#tag").val($("#tag").val() + $(this).attr("emp_no") + '|');
		})
		$("#tag_name").val($("#tag_wrap").html());
		editor.sync();
		if (check_form("form_data")) {			
			sendForm("form_data", "{:U('save')}");
		}
	}

	function popup_tag(){
		winopen("{:U('system_tag/popup?module='.MODULE_NAME)}",800,574);
	}

	$(document).ready(function(){
		editor_init();		
	}); 
</script>
<div class="doc">
	<div class="row-fluid title">
		<span>新建文档</span>
	</div>
	<form method='post' id="form_data" name="form_data" enctype="multipart/form-data">
		<input type="hidden" id="ajax" name="ajax" value="0">
		<input type="hidden" id="add_file" name="add_file">
		<input type="hidden" id="type" name="type" value="{$type}">
		<input type="hidden" id="folder" name="folder" value="{$folder}">
		<input type="hidden" id="fid" name="fid" value="{$folder}">
		<input type="hidden" id="opmode" name="opmode" value="add">
		<input type="hidden" id="tag" name="tag" >
		<input type="hidden" id="tag_name" name="tag_name" >

		<div class="row-fluid form_box">
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<label class="control-label" for="name">文件名：</label>
					<div class="controls">
						<input type="text" id="name" name="name" value="{$vo.name}" class="span12" check="require" msg="请输入文件名"></div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<label class="control-label">文档标签：</label>
					<div class="controls">
							<a onclick="popup_tag();" class="btn">选择标签</a>
							<div class="address_list" id="tag_wrap" style="display: inline-block;"></div>				
					</div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<label class="control-label" for="name">附件：</label>
					<div class="controls">
						<include file="Layout:uploader" />
					</div>
				</div>
			</div>
			<div class="row-fluid form-horizontal">
				<div class="control-group">
					<textarea id="content" name="content" style="width:100%;height:300px;" check="require" msg="请输入内容">{$vo.content}</textarea>
				</div>
			</div>
			<div class="action">
				<input class="btn default" type="button" value="保存" onclick="save();">
				<input class="btn" type="button" value="取消" onclick="go_return_url();">
			</div>
		</form>
	</div>
</div>